fix(gooddata-eval): keep alert sim-user from accepting trigger drift - #1698
fix(gooddata-eval): keep alert sim-user from accepting trigger drift#1698myhoai wants to merge 1 commit into
Conversation
The staging nightly repeatedly failed agent_alert_skill_2 and _15: the agent created ONCE_PER_INTERVAL/DAY alerts where the fixture expects ALWAYS, plus date filters nobody asked for. The chatbot was following the simulated user, whose prompt had three gaps: - The expected trigger was stated only when it differed from ALWAYS, so exactly the ALWAYS cases went unsaid. The alert prompt tells the agent to align trigger_interval with any date granularity in play "unless the user explicitly chooses a different interval", so an ALWAYS expectation only survives when the sim-user asks for it out loud. Now stated for every explicit trigger, and still silent both when the fixture omits Trigger (those cases exercise the product default) and for ANOMALY, whose product default really is ONCE_PER_INTERVAL. - The final-summary verification rule checked recipients only, so a summary showing a wrong trigger got confirmed anyway. It checked the trigger too until the logic moved into this SDK; restored, and extended to filters. - Nothing forbade extra filters. The agent volunteers a date filter for a vague question and then aligns the trigger interval to it, so refusing the filter removes the reason it had to change the trigger in the first place. Fixing the trigger rule alone would be fragile. Sampling temperature drops to 0 as well, since the drift was sampling-dependent. Each Langfuse score now carries expected-vs-actual detail. These comments also existed before the same migration and were lost with it: without them a failed trigger/filters check shows only 0.0 on the trace, and the create_metric_alert arguments have to be dug out of CI logs or of nested observations on a different trace of the session than the one the scores land on. JIRA: QA-28623 risk: nonprod
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe alert-skill evaluator now builds deterministic, rule-based simulated-user prompts, normalizes recipient arguments, handles unspecified triggers, and reports detailed per-check comments with Langfuse scores. Tests cover prompt rules, threshold formatting, scoring comments, and trace integration. ChangesAlert skill evaluation
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Evaluator
participant AlertToolCall
participant LangfuseTrace
Evaluator->>AlertToolCall: read actual alert arguments
Evaluator->>Evaluator: generate per-check scoring comments
Evaluator->>LangfuseTrace: submit boolean scores and comments
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
Summary
agent_alert_skill_2and_15fail on the staging nightly with the agent creatingONCE_PER_INTERVAL/DAYalerts where the fixture expectsALWAYS, plus date filters nobodyasked for. Not a chatbot bug — the agent follows what the simulated user agrees to, and the
sim-user prompt in
core/agentic/alert_skill.pyhad three gaps.Verified still live: run
agent_alert_skill_2026-07-29_03-11-11_gpt52_openai, item_15(
06756c61, "Alert me when our discounts are getting out of hand", expectedEvery time)scored
trigger_correct=0, with actual argstrigger=ONCE_PER_INTERVAL,trigger_interval=DAY,filters=[relativeDateFilter(order_date, DAY, -1..-1)].1. The trigger was stated only when it differed from ALWAYS — so exactly the ALWAYS cases
went unsaid. This matters more than it looks:
alert_prompt.md.jinja:333instructs the agent touse the date granularity as
trigger_interval"unless the user explicitly chooses a differentinterval", so an ALWAYS expectation only survives when the sim-user asks for it out loud. Now
stated for every explicit trigger, and still silent when the fixture omits
Trigger(those casesexercise the product default, which is
ALWAYS—prepare_metric_alert_proposal_tool.py:389)and for
ANOMALY, whose product default really isONCE_PER_INTERVALand whose trigger_check_triggerskips anyway.2. The final-summary rule checked recipients only — a summary showing a wrong trigger got
confirmed. This is a regression: gdc-nas
2b4739d091(QA-28113) already fixed it to checkrecipients and trigger, and the GDAI-1830 thin-shim migration into this SDK dropped it.
Restored, and extended to filters.
3. Nothing forbade extra filters. The agent volunteers a date filter for a vague question and
then aligns the trigger interval to it, so refusing the filter removes the reason it had to change
the trigger. Fixing the trigger rule alone would be fragile against the product prompt.
Also: sampling
temperature0.5 → 0, since the drift was sampling-dependent.Langfuse observability — each score now carries expected-vs-actual detail, e.g.
trigger_correct: expected 'ALWAYS'; actual 'ONCE_PER_INTERVAL/DAY'. These comments existedbefore the same migration and were lost with it. Without them a failed check shows only
0.0,and the
create_metric_alertarguments have to be dug out of CI logs or of nested observationson a different trace of the session than the one the scores land on (the scored trace is picked
by max latency, which for
_15was turn 2 — not the turn that created the alert).Test Plan
tests/test_agentic_alert_skill.pywith 13 tests: trigger instruction per triggerkind and its two silent cases, the no-extra-filter rule in both branches, rule numbering with
no gaps,
temperature == 0, score-comment content incl.BETWEENbounds and thenever-created case, and one covering the Langfuse branch end to end.
pytest tests/→ 256 passed (243 pre-existing + 13 new).ruff check/ruff format --checkclean on both changed files.ty check→ 15 diagnostics before and after, i.e. no new type errors.Not yet verified live:
_2/_15repeat runs against staging ongpt52_openai, to confirm thesim-user corrects at the summary and that the acceptance criteria hold end to end. Will be added
to this PR before merge.
Follow-up (deliberately not in this PR)
The GDAI-1830 migration dropped more than the three gaps above; all still missing:
threshold_from/threshold_tonever reach the sim-user (so theBETWEENitem runs withthreshold=not specified), the ANOMALY insistence rule,_describe_filters_for_prompt, and thelocal order-sensitive
_deep_subsetduplicating the order-insensitivecore/evaluators/_deep_subset.deep_subset. Kept out to keep this diff scoped to the ticket.JIRA: https://gooddata.atlassian.net/browse/QA-28623
Risk: nonprod — test-infrastructure only; no product or library code paths change.
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests